// !@#$McCaBe-InStRuMeNtAtIoN$#@!
// Instrumented with the McCabe Java Parser
// Version: 8.1.0.1 - 20110309
// Using Path Vector Instrumentation
// Date: Sun Apr 01 2012 20:41:49
package Model;

import java.util.ArrayList;

import com.mccabe.*;


class Catalog_3400ccdd26134b55e624c08b1233cff6 {
    static java.lang.Object info[];
    static {
        info = new java.lang.Object[2];
        info[0] = new Integer(-1);
        info[1] = new String("R:\\yu\\Concordia\\SOEN 344 Design II\\Term Assignment\\Code Repo\\trunk\\Iteration 3\\ERS\\src\\Model\\Catalog.java");
    }
}


/**
 * Aggregates Event occurrences 
 * @author Yury Kitaev
 *
 */
public class Catalog 
{
	private ArrayList<Event> events;
	
	public Catalog()
	{
int _mcFreq_7d0b6a9c1bbdda49efb302985e6187f5[] = new int[1];
PathVec_ERS_Iter3.enterMethod(Catalog_3400ccdd26134b55e624c08b1233cff6.info,0,_mcFreq_7d0b6a9c1bbdda49efb302985e6187f5,0);

		events = new ArrayList<Event>();
	}

	public ArrayList<Event> getEvents() 
	{
int _mcFreq_cea6fbac14d2f674896eb085b76e39f4[] = new int[1];
PathVec_ERS_Iter3.enterMethod(Catalog_3400ccdd26134b55e624c08b1233cff6.info,1,_mcFreq_cea6fbac14d2f674896eb085b76e39f4,0);

		return events;
	}

	public void setEvents(ArrayList<Event> events) 
	{
int _mcFreq_c92f751dfdb45101298b7748479e5a00[] = new int[1];
PathVec_ERS_Iter3.enterMethod(Catalog_3400ccdd26134b55e624c08b1233cff6.info,2,_mcFreq_c92f751dfdb45101298b7748479e5a00,0);

		this.events = events;
	}	
	
	/**
	 * Returns list of events.
	 * @param onlyOpen True if you would like to exclude closed events
	 * @return List of events
	 */
	public ArrayList<Event> getEvents(boolean onlyOpen)
	{
int _mcFreq_8b92ed8b87fde77f25e14558bdc79998[] = new int[7];
PathVec_ERS_Iter3.enterMethod(Catalog_3400ccdd26134b55e624c08b1233cff6.info,3,_mcFreq_8b92ed8b87fde77f25e14558bdc79998,0);

		if (
PathVec_ERS_Iter3.decision(Catalog_3400ccdd26134b55e624c08b1233cff6.info,3,_mcFreq_8b92ed8b87fde77f25e14558bdc79998,1,2,
PathVec_ERS_Iter3.testCondition(onlyOpen
))
)
		{
			ArrayList<Event> onlyOpenEvents = new ArrayList<Event>(events.size());
			
{
for (Event e : events)
			{
PathVec_ERS_Iter3.decision(Catalog_3400ccdd26134b55e624c08b1233cff6.info,3,_mcFreq_8b92ed8b87fde77f25e14558bdc79998,3,0,true);

				if (
PathVec_ERS_Iter3.decision(Catalog_3400ccdd26134b55e624c08b1233cff6.info,3,_mcFreq_8b92ed8b87fde77f25e14558bdc79998,5,6,
PathVec_ERS_Iter3.testCondition(EventStatus.Open == e.getStatus()
))
)
				{
					onlyOpenEvents.add(e);
				}
			}
PathVec_ERS_Iter3.decision(Catalog_3400ccdd26134b55e624c08b1233cff6.info,3,_mcFreq_8b92ed8b87fde77f25e14558bdc79998,4,0,true);

}

			return onlyOpenEvents;
		}
		else
		{
			return getEvents();
		}
	}
}
